<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="js/jquery-3.1.0.min.js"></script>
<title>在此处插入标题</title>
<script type="text/javascript">
$(document).ready(function(){
	$("#phone").blur(function(){
		var phone = $(this).val();
		if(!(phone.match(/^1[3|4|5|8][0-9]\d{4,8}$/))){
			alert("请输入正确的电话号码");
		}
	})
	$("#idnumber").blur(function(){
		var idnumber = $(this).val();
		if(!(idnumber.match(/\d{5}|\d{8}$/))){
			alert("请输入正确的身份证信息");
		}
	});
});
function hidd(){
	var span = document.getElementById("sname");
	span.style.display = "none";
}
function show(){
	var span = document.getElementById("sname");
	span.style.display = "block";
}
function reg(){
	var pas = document.f.password.value;
	var pas2 = document.f.password1.value;
	if(pas==""){
		alert("请输入密码");
	}else if(pas!=pas2){
		document.f.password.value = "";
		document.f.password1.value="";
		alert("您两次输入的密码不一致");
	}else{
	$("form").submit();
	}
}
</script>
</head>
<body>
<form action="RegisterServlet" name="f">
用户名：<input type="text" name="username"><br>
密码：<input type="password" name="password"><br>
确认密码：<input type="password" name="password1"><br>
昵称：<input type="text" name="nickname"><br>

手机号：<input type="text" name="phone"id="phone"><br>
真实姓名：<input type="text" name="truename" ><br>
证件号：<input type="text" name="idnumber" id="idnumber"><br>
角色：
商家用户：<input type="radio" name="role" value="0" onclick="show();">
普通用户：<input type="radio" name="role" value="1" onclick="hidd();" checked>
<br>
<span id="sname" style="display:none">店铺名称：<input type="text" name="shopname"><br></span>
<input type="button" value="注册" onclick="reg();">
</form>
</body>
</html>